package com.yan.community.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.yan.club.result.Result;
import com.yan.community.mapper.ClubCommunityDeptMapper;
import com.yan.community.model.ClubCommunityDept;
import com.yan.community.model.ClubCommunityDeptExample;
import com.yan.community.service.ClubCommunityDeptService;

/**
 * @author 彦
 * @since 2024/1/15 16:03
 */
@Service
public class ClubCommunityDeptServiceImpl implements ClubCommunityDeptService {

    @Resource
    private ClubCommunityDeptMapper clubCommunityDeptMapper;

    /**
     * 根据id得到社团的种类
     *
     * @param communityId
     * @return
     */
    @Override
    public Result<List<ClubCommunityDept>> getCommunityDeptById(Long communityId) {
        ClubCommunityDeptExample ex = new ClubCommunityDeptExample();
        ex.createCriteria().andCommunityIdEqualTo(communityId);
        List<ClubCommunityDept> clubCommunityDepts = clubCommunityDeptMapper.selectByExample(ex);

        return Result.success(clubCommunityDepts);
    }
}
